package backed.config;

import com.qcloud.cos.COSClient;
import com.qcloud.cos.ClientConfig;
import com.qcloud.cos.auth.BasicCOSCredentials;
import com.qcloud.cos.auth.COSCredentials;
import com.qcloud.cos.region.Region;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class CosConfig {
    
    private static final String SECRET_ID = "AKIDsjNo2b1EF3d5MPEqEPM6buzrVxCE2e5K";
    private static final String SECRET_KEY = "6yc3GF0XszsXzDH7j8KK6f193kEWaQ3a";
    private static final String REGION = "ap-beijing";
    public static final String BUCKET = "luke-1332125786";
    public static final String DOMAIN = "https://luke-1332125786.cos.ap-beijing.myqcloud.com";
    
    @Bean
    public COSClient cosClient() {
        COSCredentials cred = new BasicCOSCredentials(SECRET_ID, SECRET_KEY);
        Region region = new Region(REGION);
        ClientConfig clientConfig = new ClientConfig(region);
        return new COSClient(cred, clientConfig);
    }
}
